Package gwtappcontainer.server.apps.insight

Source Code of gwtappcontainer.server.apps.insight.PractiseRepositoryTest

package gwtappcontainer.server.apps.insight;

import static org.junit.Assert.assertTrue;
import gwtappcontainer.shared.apps.insight.Practise;

import java.util.ArrayList;

import org.junit.Before;
import org.junit.Test;

public class PractiseRepositoryTest {
 
  @Before
  public void setUp() {
    System.setProperty("junittesting", "true");
   
    ArrayList<Practise> practises = PractiseRepository.getAll();
   
    for (Practise practise : practises) {
      PractiseRepository.delete(practise.name);
    }
  }
 
  @Test
  public void getTest() {
    Practise practise = PractiseRepository.get("aum chanting");
    assertTrue(practise == null);
   
    PractiseRepository.add("Aum ChanTing");
    practise = PractiseRepository.get("aum chanting");
    assertTrue(practise != null);
    assertTrue(practise.id != 0);
    assertTrue(practise.name.equals("aum chanting"));
  }
 
  @Test
  public void addTest() {
    Practise practise = PractiseRepository.get("shakthi chalana kriya");
    assertTrue(practise == null);
   
    PractiseRepository.add("shakthi chalana KRiya");
    practise = PractiseRepository.get("shakthi chalana kriYA");
    assertTrue(practise != null);
    assertTrue(practise.id != 0);
    assertTrue(practise.name.equals("shakthi chalana kriya"));
  }
 
  @Test
  public void getAllTest() {
    PractiseRepository.add("shakTHi chalana kriya");
    PractiseRepository.add("aum chaNTing");
    PractiseRepository.add("surya kRIya");
   
    ArrayList<Practise> practises = PractiseRepository.getAll();
    //should be saved in lowercase, sorted by practise
    assertTrue(practises.size() == 3);
    assertTrue(practises.get(0).name.equals("aum chanting"));
    assertTrue(practises.get(1).name.equals("shakthi chalana kriya"));
    assertTrue(practises.get(2).name.equals("surya kriya"));
  }
}
TOP

Related Classes of gwtappcontainer.server.apps.insight.PractiseRepositoryTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.